package pers.cz.service.impl;

import pers.cz.business.DataSyncBusiness;
import pers.cz.model.DatabaseDtl;
import pers.cz.pub.BeanHelper;
import pers.cz.service.DataSyncSercice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: PostGirl-panent
 * @description: DataSyncSerciceImpl
 * @author: Cheng Zhi
 * @create: 2021-05-26 16:12
 **/
@Service
public class DataSyncSerciceImpl implements DataSyncSercice {

    @Autowired
    BeanHelper beanHelper;

    @Override
    public Integer addDatabaseDtl(DatabaseDtl databaseDtl) {

        DataSyncBusiness business = new DataSyncBusiness();
        business.setMapper(beanHelper);

        return business.addDatabaseDtl(databaseDtl);
    }

    @Override
    public List<DatabaseDtl> queryALLDataBaseDtl() {
        DataSyncBusiness business = new DataSyncBusiness();
        business.setMapper(beanHelper);
        return business.queryALLDataBaseDtl();
    }

    @Override
    public List<DatabaseDtl> queryALLDataBaseDtlByPage(Integer pageStart, Integer pageLimit) {

        DataSyncBusiness business = new DataSyncBusiness();
        business.setMapper(beanHelper);
        return business.queryAllDataBaseDtlByPage(pageStart, pageLimit);
    }

    @Override
    public Integer getDataBaseDtlTotalNum() {
        DataSyncBusiness business = new DataSyncBusiness();
        business.setMapper(beanHelper);
        return business.quertDataBaseDtlTotalNum();
    }

    @Override
    public Integer updateDataBaseDtl(DatabaseDtl databaseDtl) {
        DataSyncBusiness business = new DataSyncBusiness();
        business.setMapper(beanHelper);
        return business.updateDataBaseDtl(databaseDtl);
    }

    @Override
    public Integer deleteDataBaseDtl(int id) {
        DataSyncBusiness business = new DataSyncBusiness();
        business.setMapper(beanHelper);
        return business.deleteDataBaseDtl(id);
    }
}
